<%@page import="pl.org.waff.repository.*"%>
<%@page import="pl.org.waff.WaffServlet"%>
<%@page import="java.util.List, java.util.Properties" %>
<%@page contentType="text/html" pageEncoding="UTF-8"%>
<jsp:useBean id="repository" class="pl.org.waff.repository.InMemoryContentCache" scope="application" />
<jsp:useBean id="cmswitch" class="pl.org.waff.cm.CMSwitch" scope="session" />
<div>
    Document types:<br/>
    <% String rootPath = (String) request.getSession().getAttribute(WaffServlet.PATH_PREFIX_ATTRIBUTE_NAME);
        if (rootPath == null) {
            rootPath = "";
        } else if (rootPath.endsWith("/")) {
            rootPath = rootPath.substring(0, rootPath.length() - 1);
        }
        Properties cInfo=repository.getCommentsInfo(null);
        List types = repository.getAllTypes();
        String typeName;
        String typeJsp;
        out.print("<table width='100%'>");
        for(int i=0; i<types.size(); i++) {
            typeName=(String)types.get(i);
            typeJsp="new"+typeName+".jsp";
            out.print("<tr><td>"+typeName + "</td><td align='right'>");%>
    <jsp:include page="<%=typeJsp%>"/>
    <% out.print("</td></tr>");
}
out.print("</table>");
    %>
    <hr/>
Comments:<br/><%=cInfo.getProperty("counter")%> <%=cInfo.getProperty("created")%>
    <hr/>
    Folders:<br/>
    <% List subfolders = repository.getAllFolders();
        String oldPath=cmswitch.getPath();
                if(oldPath==null){
            oldPath="/";
        }
        out.print("<table width='100%'>");
        String tmpPath;
        for(int i=0; i<subfolders.size();i++){
            tmpPath = (String) subfolders.get(i);
            out.print("<tr>");
            if(tmpPath.equals(oldPath)){
                out.print("<td>&gt;</td>");
            }else{
                out.print("<td>&nbsp;</td>");
            }
            out.print("<td width='90%'><a href='cmswitch.do?view=fl&docid=&path="+tmpPath+"'>" + tmpPath + "</a></td><td>");
            out.print("</td>");
        }
        out.print("</table>");
    %>
</div>